/*     */ import java.awt.Color;
/*     */ import java.awt.Container;
/*     */ import java.awt.Dimension;
/*     */ import java.awt.Font;
/*     */ import java.awt.Graphics;
/*     */ import java.awt.Graphics2D;
/*     */ import java.awt.Insets;
/*     */ import java.awt.event.ActionEvent;
/*     */ import java.awt.event.ActionListener;
/*     */ import java.awt.event.MouseEvent;
/*     */ import java.awt.event.MouseMotionListener;
import java.awt.geom.Line2D;
/*     */ import java.awt.geom.Line2D.Double;
/*     */ import java.text.DecimalFormat;
/*     */ import java.util.Arrays;
/*     */ import java.util.List;
/*     */ import javax.swing.BorderFactory;
/*     */ import javax.swing.Box;
/*     */ import javax.swing.BoxLayout;
/*     */ import javax.swing.JButton;
/*     */ import javax.swing.JDialog;
/*     */ import javax.swing.JFrame;
/*     */ import javax.swing.JLabel;
/*     */ import javax.swing.JOptionPane;
/*     */ import javax.swing.JPanel;
/*     */ import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
/*     */ 
/*     */ public class EFIChart extends JPanel
/*     */   implements MouseMotionListener, BBIInterface, ActionListener
/*     */ {
/*     */   private SymQuotes sq;
/*     */   private String sym;
/*  14 */   private float yScale = 1.0F;
/*  15 */   private float xScale = 1.0F;
/*     */   private double stickWidth;
/*     */   private float minVal;
/*     */   private float maxVal;
/*     */   private int parm1;
/*     */   private int parm2;
/*     */   private float[] efi;
/*     */   private float[] efiEma_parm1;
/*     */   private float[] MA_parm2OfEfiEma_parm1;
/*  22 */   private String m = "";
/*     */   private int mX;
/*     */   private int mY;
/*  24 */   public int noOfDays = 150;
/*     */   private double p1Y;
/*     */   private double p2Y;
/*     */   private double p11Y;
/*     */   private double p22Y;
/*     */   private double p0Y;
/*     */   private JTextField parm1TF;
/*     */   private JTextField parm2TF;
/*     */   private JButton chgParmOk;
/*     */   private JButton chgParmCancel;
/*     */   private JButton defaultParms;
/*     */   private JDialog chgParmDialog;
/*  32 */   private DecimalFormat df = new DecimalFormat("0.00E00");
/*     */ 
/*  34 */   public String trend = "";
/*     */   public EFIChart.EastPanel ep;
/*     */   private double refY;
/*     */   private double refX;
/* 552 */   private Font ssp10 = new Font("SansSerif", 0, 10);
/* 553 */   private Font ssp9 = new Font("SansSerif", 0, 9);
/* 554 */   private Line2D.Double refL1 = new Line2D.Double();
/* 555 */   private Line2D.Double refL2 = new Line2D.Double();
/* 556 */   private Line2D.Double gridY = new Line2D.Double();
/* 557 */   private Line2D.Double gridX = new Line2D.Double();
/* 558 */   private Line2D.Double yrefL1 = new Line2D.Double();
/* 559 */   private Line2D.Double yrefL2 = new Line2D.Double();
/*     */   private double yfactor;
/*     */   private double startPointX;
/*     */   private int dateRef;
/*     */   private int daysRef;
/* 564 */   private Line2D.Double l0 = new Line2D.Double();
/* 565 */   private Line2D.Double l1 = new Line2D.Double();
/* 566 */   private Line2D.Double l2 = new Line2D.Double();
/*     */   private double x1;
/*     */   private double y1;
/*     */   private double x2;
/*     */   private double y2;
/*     */   private double u1;
/*     */   private double v1;
/*     */   private double u2;
/*     */   private double v2;
/*     */   private double a1;
/*     */   private double b1;
/*     */   private double a2;
/*     */   private double b2;
/*     */   private double xi;
/*     */   private double yi;
/* 568 */   private Line2D.Double uA = new Line2D.Double();
/* 569 */   private Line2D.Double lA = new Line2D.Double();
/* 570 */   private Line2D.Double hA = new Line2D.Double();
/*     */ 
/*     */   public EFIChart(SymQuotes paramSymQuotes, int paramInt1, int paramInt2)
/*     */   {
/*  39 */     this.sq = paramSymQuotes;
/*  40 */     this.sym = paramSymQuotes.sym;
/*     */ 
/*  42 */     this.efi = new float[paramSymQuotes.count];
/*  43 */     this.efiEma_parm1 = new float[paramSymQuotes.count];
/*  44 */     this.MA_parm2OfEfiEma_parm1 = new float[paramSymQuotes.count];
/*     */ 
/*  46 */     this.parm1 = paramInt1;
/*  47 */     this.parm2 = paramInt2;
/*     */ 
/*  49 */     if (this.noOfDays == 150)
/*  50 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else {
/*  52 */       this.stickWidth = (1.5D * this.xScale);
/*     */     }
/*  54 */     setBackground(Color.black);
/*  55 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */ 
/*  57 */     efiFinder();
/*     */ 
/*  59 */     if (paramInt1 + 2 < paramSymQuotes.count) {
/*  60 */       efiEma_parm1Finder();
/*     */     }
/*  62 */     if (paramInt1 + paramInt2 + 2 < paramSymQuotes.count) {
/*  63 */       MA_parm2OfEfiEma_parm1Finder();
/*     */     }
/*  65 */     findMinMax();
/*  66 */     addMouseMotionListener(this);
/*     */ 
/*  68 */     if (this.efiEma_parm1[(paramSymQuotes.count - 1)] >= this.MA_parm2OfEfiEma_parm1[(paramSymQuotes.count - 1)])
/*  69 */       this.trend = "Bullish";
/*     */     else {
/*  71 */       this.trend = "Bearish";
/*     */     }
/*  73 */     this.ep = new EFIChart.EastPanel();
/*     */   }
/*     */ 
/*     */   public int getBBIdata(int paramInt)
/*     */   {
/*  80 */     if (this.efiEma_parm1[paramInt] >= this.MA_parm2OfEfiEma_parm1[paramInt]) {
/*  81 */       return 1;
/*     */     }
/*  83 */     return 0;
/*     */   }
/*     */ 
/*     */   public void changeNoOfDays(int paramInt)
/*     */   {
/*  90 */     this.noOfDays = paramInt;
/*     */ 
/*  92 */     if (paramInt == 150)
/*  93 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/*  95 */       this.stickWidth = (1.5D * this.xScale);
/*  96 */     findMinMax();
/*     */   }
/*     */ 
/*     */   public void redrawChart(SymQuotes paramSymQuotes)
/*     */   {
/* 103 */     this.sq = paramSymQuotes;
/* 104 */     this.sym = paramSymQuotes.sym;
/*     */ 
/* 106 */     this.efi = new float[paramSymQuotes.count];
/* 107 */     this.efiEma_parm1 = new float[paramSymQuotes.count];
/* 108 */     this.MA_parm2OfEfiEma_parm1 = new float[paramSymQuotes.count];
/*     */ 
/* 110 */     if (this.noOfDays == 150)
/* 111 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else {
/* 113 */       this.stickWidth = (1.5D * this.xScale);
/*     */     }
/* 115 */     efiFinder();
/*     */ 
/* 117 */     if (this.parm1 + 2 < paramSymQuotes.count) {
/* 118 */       efiEma_parm1Finder();
/*     */     }
/* 120 */     if (this.parm1 + this.parm2 + 2 < paramSymQuotes.count) {
/* 121 */       MA_parm2OfEfiEma_parm1Finder();
/*     */     }
/* 123 */     findMinMax();
/*     */ 
/* 125 */     if (this.efiEma_parm1[(paramSymQuotes.count - 1)] >= this.MA_parm2OfEfiEma_parm1[(paramSymQuotes.count - 1)])
/* 126 */       this.trend = "Bullish";
/*     */     else {
/* 128 */       this.trend = "Bearish";
/*     */     }
/* 130 */     repaint();
/* 131 */     this.ep.updateValues();
/*     */   }
/*     */ 
/*     */   public void redrawChart()
/*     */   {
/* 138 */     Arrays.fill(this.efi, 0.0F);
/* 139 */     Arrays.fill(this.efiEma_parm1, 0.0F);
/* 140 */     Arrays.fill(this.MA_parm2OfEfiEma_parm1, 0.0F);
/*     */ 
/* 142 */     efiFinder();
/*     */ 
/* 144 */     if (this.parm1 + 2 < this.sq.count) {
/* 145 */       efiEma_parm1Finder();
/*     */     }
/* 147 */     if (this.parm1 + this.parm2 + 2 < this.sq.count) {
/* 148 */       MA_parm2OfEfiEma_parm1Finder();
/*     */     }
/* 150 */     findMinMax();
/*     */ 
/* 152 */     if (this.efiEma_parm1[(this.sq.count - 1)] >= this.MA_parm2OfEfiEma_parm1[(this.sq.count - 1)])
/* 153 */       this.trend = "Bullish";
/*     */     else {
/* 155 */       this.trend = "Bearish";
/*     */     }
/* 157 */     repaint();
/* 158 */     this.ep.updateValues();
/*     */   }
/*     */ 
/*     */   public void mouseMoved(MouseEvent paramMouseEvent)
/*     */   {
/* 166 */     int j = 1;
/* 167 */     if ((paramMouseEvent.getX() >= 50) && (paramMouseEvent.getX() <= 750.0F * this.xScale + 50.0F) && (paramMouseEvent.getY() >= 10) && (paramMouseEvent.getY() <= this.yScale * 100.0F + 10.0F))
/*     */     {
/* 169 */       int i = (int)((750.0F * this.xScale - (paramMouseEvent.getX() - 50) - this.stickWidth / 2.0D) / (this.stickWidth + 1.0F * this.xScale));
/*     */ 
/* 171 */       if (this.sq.count - 1 >= i)
/*     */       {
/* 173 */         j = this.sq.count - 1 - i;
/* 174 */         this.m = ("( " + (String)this.sq.date.get(j) + ", EFI EMA[" + this.parm1 + "]:" + this.df.format(this.efiEma_parm1[j]) + "  MA" + this.parm2 + "(EFI EMA[" + this.parm1 + "]):" + this.df.format(this.MA_parm2OfEfiEma_parm1[j]) + " )");
/*     */ 
/* 176 */         this.mX = paramMouseEvent.getX();
/* 177 */         this.mY = paramMouseEvent.getY();
/* 178 */         repaint();
/* 179 */         return;
/*     */       }
/*     */ 
/* 183 */       this.m = "";
/*     */ 
/* 185 */       repaint();
/* 186 */       return;
/*     */     }
/*     */ 
/* 190 */     this.m = "";
/* 191 */     repaint();
/*     */   }
/*     */ 
/*     */   public void mouseDragged(MouseEvent paramMouseEvent)
/*     */   {
/*     */   }
/*     */ 
/*     */   private void drawValues(Graphics2D paramGraphics2D)
/*     */   {
/* 204 */     paramGraphics2D.setPaint(Color.cyan);
/*     */ 
/* 206 */     if (this.mX + this.m.length() * 5 > 750.0F * this.xScale + 50.0F) {
/* 207 */       this.mX -= this.m.length() * 5;
/*     */     }
/* 209 */     paramGraphics2D.drawString(this.m, this.mX, this.mY);
/*     */   }
/*     */ 
/*     */   private void efiFinder()
/*     */   {
/* 216 */     for (int i = 2; i < this.sq.count; i++)
/*     */     {
/* 218 */       this.efi[i] = ((((Float)this.sq.close.get(i)).floatValue() - ((Float)this.sq.close.get(i - 1)).floatValue()) * ((Integer)this.sq.qty.get(i)).intValue());
/*     */     }
/*     */   }
/*     */ 
/*     */   private void efiEma_parm1Finder()
/*     */   {
/* 227 */     for (int i = 0; i < this.parm1 + 2; i++) {
/* 228 */       this.efiEma_parm1[i] = 0.0F;
/*     */     }
/* 230 */     float f1 = 0.0F;
/* 231 */     for (int j = this.parm1 + 2; j > 2; j--)
/*     */     {
/* 233 */       f1 += this.efi[j];
/*     */     }
/*     */ 
/* 237 */     this.efiEma_parm1[(this.parm1 + 2)] = (f1 / this.parm1);
/*     */ 
/* 239 */     float f2 = 2.0F / (this.parm1 + 1);
/*     */ 
/* 241 */     for (int k = this.parm1 + 3; k < this.sq.count; k++)
/*     */     {
/* 243 */       this.efiEma_parm1[k] = (this.efi[k] * f2 + this.efiEma_parm1[(k - 1)] * (1.0F - f2));
/*     */     }
/*     */   }
/*     */ 
/*     */   private void MA_parm2OfEfiEma_parm1Finder()
/*     */   {
/* 252 */     for (int i = 0; i < this.parm1 + this.parm2 + 2; i++) {
/* 253 */       this.MA_parm2OfEfiEma_parm1[i] = 0.0F;
/*     */     }
/* 255 */     for (int i = this.parm1 + this.parm2 + 2; i < this.sq.count; i++)
/*     */     {
/* 257 */       float f = 0.0F;
/* 258 */       for (int j = i; j > i - this.parm2; j--)
/*     */       {
/* 260 */         f += this.efiEma_parm1[j];
/*     */       }
/*     */ 
/* 263 */       this.MA_parm2OfEfiEma_parm1[i] = (f / this.parm2);
/*     */     }
/*     */   }
/*     */ 
/*     */   private void findMinMax()
/*     */   {
/* 272 */     int i = 1;
/* 273 */     this.minVal = this.efiEma_parm1[(this.sq.count - 1)];
/* 274 */     this.maxVal = this.efiEma_parm1[(this.sq.count - 1)];
/*     */ 
/* 276 */     for (int j = this.sq.count - 1; j >= this.parm1 + 2; j--)
/*     */     {
/* 278 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 281 */       if (this.minVal > this.efiEma_parm1[j]) {
/* 282 */         this.minVal = this.efiEma_parm1[j];
/*     */       }
/* 284 */       if (this.maxVal < this.efiEma_parm1[j]) {
/* 285 */         this.maxVal = this.efiEma_parm1[j];
/*     */       }
/* 287 */       i += 1;
/*     */     }
/*     */ 
/* 291 */     i = 1;
/* 292 */     for (int j = this.sq.count - 1; j >= this.parm1 + this.parm2 + 2; j--)
/*     */     {
/* 294 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 297 */       if (this.minVal > this.MA_parm2OfEfiEma_parm1[j]) {
/* 298 */         this.minVal = this.MA_parm2OfEfiEma_parm1[j];
/*     */       }
/* 300 */       if (this.maxVal < this.MA_parm2OfEfiEma_parm1[j]) {
/* 301 */         this.maxVal = this.MA_parm2OfEfiEma_parm1[j];
/*     */       }
/* 303 */       i += 1;
/*     */     }
/*     */   }
/*     */ 
/*     */   public void updateParms(int paramInt1, int paramInt2)
/*     */   {
/* 313 */     this.parm1 = paramInt1;
/* 314 */     this.parm2 = paramInt2;
/*     */ 
/* 316 */     efiFinder();
/* 317 */     efiEma_parm1Finder();
/* 318 */     MA_parm2OfEfiEma_parm1Finder();
/* 319 */     findMinMax();
/*     */   }
/*     */ 
/*     */   public Box getEFIBox(boolean paramBoolean)
/*     */   {
/* 326 */     Box localBox = Box.createHorizontalBox();
/* 327 */     TitledBorder localTitledBorder = BorderFactory.createTitledBorder("EFI");
/*     */ 
/* 329 */     this.parm1TF = new JTextField("" + this.parm1, 2);
/* 330 */     this.parm2TF = new JTextField("" + this.parm2, 2);
/* 331 */     this.parm1TF.setFont(this.ssp10);
/* 332 */     this.parm2TF.setFont(this.ssp10);
/* 333 */     this.parm1TF.setMaximumSize(new Dimension(25, 20));
/* 334 */     this.parm2TF.setMaximumSize(new Dimension(25, 20));
/*     */ 
/* 336 */     JLabel localJLabel1 = new JLabel("EFI EMA[");
/* 337 */     JLabel localJLabel2 = new JLabel("] ,  MA");
/* 338 */     JLabel localJLabel3 = new JLabel("of EFI EMA     ");
/*     */ 
/* 340 */     localJLabel1.setFont(this.ssp10);
/* 341 */     localJLabel2.setFont(this.ssp10);
/* 342 */     localJLabel3.setFont(this.ssp10);
/*     */ 
/* 344 */     localBox.add(localJLabel1);
/* 345 */     localBox.add(this.parm1TF);
/* 346 */     localBox.add(localJLabel2);
/* 347 */     localBox.add(this.parm2TF);
/* 348 */     localBox.add(localJLabel3);
/*     */ 
/* 350 */     localBox.add(Box.createHorizontalGlue());
/*     */ 
/* 352 */     if (paramBoolean) {
/* 353 */       localBox.setBorder(localTitledBorder);
/*     */     }
/* 355 */     return localBox;
/*     */   }
/*     */ 
/*     */   public void showChgParmDialog()
/*     */   {
/* 362 */     JFrame localJFrame = new JFrame();
/* 363 */     this.chgParmDialog = new JDialog(localJFrame, "Change EFI Parameters", true);
/* 364 */     Box localBox1 = Box.createVerticalBox();
/* 365 */     Box localBox2 = Box.createHorizontalBox();
/*     */ 
/* 367 */     this.chgParmOk = new JButton("OK");
/* 368 */     this.chgParmOk.setFont(this.ssp10);
/* 369 */     this.chgParmOk.setMargin(new Insets(1, 2, 1, 2));
/* 370 */     this.chgParmOk.addActionListener(this);
/*     */ 
/* 372 */     this.chgParmCancel = new JButton("Cancel");
/* 373 */     this.chgParmCancel.setFont(this.ssp10);
/* 374 */     this.chgParmCancel.setMargin(new Insets(1, 2, 1, 2));
/* 375 */     this.chgParmCancel.addActionListener(this);
/*     */ 
/* 377 */     this.defaultParms = new JButton("Default");
/* 378 */     this.defaultParms.setFont(this.ssp10);
/* 379 */     this.defaultParms.setMargin(new Insets(1, 2, 1, 2));
/* 380 */     this.defaultParms.setToolTipText("Reset to default parameters");
/* 381 */     this.defaultParms.addActionListener(this);
/*     */ 
/* 383 */     localBox2.add(Box.createHorizontalGlue());
/* 384 */     localBox2.add(this.chgParmOk);
/* 385 */     localBox2.add(Box.createHorizontalStrut(5));
/* 386 */     localBox2.add(this.chgParmCancel);
/* 387 */     localBox2.add(Box.createHorizontalStrut(5));
/* 388 */     localBox2.add(this.defaultParms);
/* 389 */     localBox2.add(Box.createHorizontalGlue());
/*     */ 
/* 391 */     localBox1.add(getEFIBox(true));
/* 392 */     localBox1.add(localBox2);
/*     */ 
/* 394 */     this.chgParmDialog.getContentPane().add(localBox1);
/* 395 */     this.chgParmDialog.setSize(250, 100);
/* 396 */     this.chgParmDialog.setLocationRelativeTo(this.ep);
/* 397 */     this.chgParmDialog.setVisible(true);
/*     */   }
/*     */ 
/*     */   public boolean validateParm()
/*     */   {
/* 404 */     int i = this.parm1;
/* 405 */     int j = this.parm2;
/*     */     try
/*     */     {
/* 409 */       i = Integer.parseInt(this.parm1TF.getText().trim());
/* 410 */       j = Integer.parseInt(this.parm2TF.getText().trim());
/*     */     }
/*     */     catch (NumberFormatException localNumberFormatException)
/*     */     {
/* 416 */       JOptionPane.showMessageDialog(null, "Error in EFI parameter.Enter only numbers greater than 2.", null, 0);
/*     */ 
/* 419 */       this.parm1TF.setText("" + this.parm1);
/* 420 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 422 */       return false;
/*     */     }
/*     */ 
/* 426 */     if ((i > 200) || (j > 200))
/*     */     {
/* 428 */       JOptionPane.showMessageDialog(null, "Error in EFI parameter.Enter values between 2 and 200.", null, 0);
/*     */ 
/* 431 */       this.parm1TF.setText("" + this.parm1);
/* 432 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 434 */       return false;
/*     */     }
/*     */ 
/* 438 */     if ((i < 2) || (j < 2))
/*     */     {
/* 440 */       JOptionPane.showMessageDialog(null, "Error in EFI parameter.Enter values between 2 and 200.", null, 0);
/*     */ 
/* 443 */       this.parm1TF.setText("" + this.parm1);
/* 444 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 446 */       return false;
/*     */     }
/*     */ 
/* 450 */     this.parm1 = i;
/* 451 */     this.parm2 = j;
/*     */ 
/* 453 */     return true;
/*     */   }
/*     */ 
/*     */   public void actionPerformed(ActionEvent paramActionEvent)
/*     */   {
/* 460 */     if (paramActionEvent.getSource() == this.chgParmOk)
/*     */     {
/* 462 */       if (!validateParm()) {
/* 463 */         return;
/*     */       }
/* 465 */       redrawChart();
/* 466 */       this.chgParmDialog.dispose();
/*     */     }
/*     */ 
/* 470 */     if (paramActionEvent.getSource() == this.chgParmCancel)
/*     */     {
/* 472 */       this.chgParmDialog.dispose();
/*     */     }
/*     */ 
/* 476 */     if (paramActionEvent.getSource() == this.defaultParms)
/*     */     {
/* 478 */       setDefaultParms();
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setDefaultParms()
/*     */   {
/* 486 */     this.parm1TF.setText("10");
/* 487 */     this.parm2TF.setText("5");
/*     */   }
/*     */ 
/*     */   public void vZoom(boolean paramBoolean)
/*     */   {
/* 494 */     if (paramBoolean)
/* 495 */       this.yScale += 0.2F;
/* 496 */     else if (this.yScale >= 1.2F) {
/* 497 */       this.yScale -= 0.2F;
/*     */     }
/* 499 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   public void hZoom(boolean paramBoolean)
/*     */   {
/* 506 */     if (paramBoolean)
/* 507 */       this.xScale += 0.2F;
/* 508 */     else if (this.xScale >= 1.2F) {
/* 509 */       this.xScale -= 0.2F;
/*     */     }
/* 511 */     if (this.noOfDays == 150)
/* 512 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/* 514 */       this.stickWidth = (1.5D * this.xScale);
/* 515 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   public void resetZoom()
/*     */   {
/* 522 */     this.yScale = 1.0F;
/* 523 */     this.xScale = 1.0F;
/* 524 */     if (this.noOfDays == 150)
/* 525 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/* 527 */       this.stickWidth = (1.5D * this.xScale);
/* 528 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   protected void clear(Graphics paramGraphics)
/*     */   {
/* 535 */     super.paintComponent(paramGraphics);
/*     */   }
/*     */ 
/*     */   protected void paintComponent(Graphics paramGraphics)
/*     */   {
/* 542 */     clear(paramGraphics);
/* 543 */     Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
/* 544 */     drawChart(localGraphics2D);
/* 545 */     drawValues(localGraphics2D);
/*     */   }
/*     */ 
/*     */   private void drawChart(Graphics2D paramGraphics2D)
/*     */   {
/* 575 */     this.refY = 10.0D;
/* 576 */     this.refX = 50.0D;
/* 577 */     setFont(this.ssp10);
/* 578 */     String str = "Elder Force Index";
/* 579 */     paramGraphics2D.setPaint(new Color(100, 240, 250));
/* 580 */     paramGraphics2D.drawString(str, 50, 10);
/*     */ 
/* 582 */     str = "EFI EMA[" + this.parm1 + "]";
/* 583 */     paramGraphics2D.setPaint(new Color(50, 150, 255));
/* 584 */     paramGraphics2D.drawString(str, 145, 10);
/*     */ 
/* 586 */     str = "MA " + this.parm2 + "[EFI EMA[" + this.parm1 + "]]";
/* 587 */     paramGraphics2D.setPaint(new Color(255, 90, 10));
/* 588 */     paramGraphics2D.drawString(str, 215, 10);
/*     */ 
/* 591 */     this.refL1.setLine(50.0D, 10.0D, 50.0D, this.yScale * 100.0F + 10.0F);
/* 592 */     this.refL2.setLine(750.0F * this.xScale + 50.0F, 10.0D, 750.0F * this.xScale + 50.0F, this.yScale * 100.0F + 10.0F);
/* 593 */     paramGraphics2D.setPaint(Color.white);
/* 594 */     paramGraphics2D.draw(this.refL1);
/* 595 */     paramGraphics2D.draw(this.refL2);
/*     */ 
/* 597 */     for (int i = 0; i < 14; i++)
/*     */     {
/* 599 */       this.refX += 50.0F * this.xScale;
/* 600 */       this.gridY.setLine(this.refX, 10.0D, this.refX, this.yScale * 100.0F + 10.0F);
/* 601 */       paramGraphics2D.setPaint(Color.darkGray);
/* 602 */       paramGraphics2D.draw(this.gridY);
/*     */     }
int i;
/*     */ 
/* 606 */     for (i = 0; i < 11; i++)
/*     */     {
/* 608 */       this.yrefL1.setLine(50.0D, this.refY, 40.0D, this.refY);
/* 609 */       str = this.df.format(this.maxVal - (this.maxVal - this.minVal) / 10.0F * i);
/* 610 */       paramGraphics2D.setPaint(Color.lightGray);
/* 611 */       paramGraphics2D.drawString(str, 5, (int)this.refY);
/* 612 */       this.yrefL2.setLine(750.0F * this.xScale + 50.0F, this.refY, 750.0F * this.xScale + 60.0F, this.refY);
/*     */ 
/* 614 */       paramGraphics2D.drawString(str, (int)(750.0F * this.xScale + 53.0F), (int)this.refY);
/* 615 */       this.gridX.setLine(50.0D, this.refY, 750.0F * this.xScale + 50.0F, this.refY);
/* 616 */       paramGraphics2D.setPaint(Color.white);
/* 617 */       paramGraphics2D.draw(this.yrefL1);
/* 618 */       paramGraphics2D.draw(this.yrefL2);
/* 619 */       paramGraphics2D.setPaint(Color.darkGray);
/* 620 */       paramGraphics2D.draw(this.gridX);
/* 621 */       this.refY += 10.0F * this.yScale;
/*     */     }
/*     */ 
/* 625 */     this.yfactor = (this.yScale * 100.0F / (this.maxVal - this.minVal));
/* 626 */     this.startPointX = (750.0F * this.xScale + 50.0F - (this.stickWidth + 1.0F * this.xScale));
/* 627 */     this.dateRef = (this.sq.count - 1);
/* 628 */     this.daysRef = 1;
/*     */ 
/* 631 */     this.p0Y = (this.yScale * 100.0F + 10.0F - (0.0F - this.minVal) * this.yfactor);
/* 632 */     this.l0.setLine(50.0D, this.p0Y, 750.0F * this.xScale + 50.0F, this.p0Y);
/* 633 */     paramGraphics2D.setPaint(Color.white);
/* 634 */     paramGraphics2D.draw(this.l0);
/*     */ 
/* 637 */     for (i = this.sq.count - 1; i > this.parm1; i--)
/*     */     {
/* 639 */       if (this.daysRef == this.noOfDays)
/*     */         break;
/* 641 */       paramGraphics2D.setFont(this.ssp10);
/*     */ 
/* 644 */       if (i > this.parm1 + this.parm2 + 2)
/*     */       {
/* 646 */         this.p1Y = (this.yScale * 100.0F + 10.0F - (this.MA_parm2OfEfiEma_parm1[i] - this.minVal) * this.yfactor);
/* 647 */         this.p2Y = (this.yScale * 100.0F + 10.0F - (this.MA_parm2OfEfiEma_parm1[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 649 */         this.l1.setLine(this.startPointX, this.p1Y, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p2Y);
/* 650 */         paramGraphics2D.setPaint(new Color(255, 90, 10));
/* 651 */         paramGraphics2D.draw(this.l1);
/*     */       }
/*     */ 
/* 655 */       if (i > this.parm1 + 2)
/*     */       {
/* 657 */         this.p11Y = (this.yScale * 100.0F + 10.0F - (this.efiEma_parm1[i] - this.minVal) * this.yfactor);
/* 658 */         this.p22Y = (this.yScale * 100.0F + 10.0F - (this.efiEma_parm1[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 660 */         this.l2.setLine(this.startPointX, this.p11Y, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p22Y);
/* 661 */         paramGraphics2D.setPaint(new Color(50, 150, 255));
/* 662 */         paramGraphics2D.draw(this.l2);
/*     */       }
/*     */ 
/* 666 */       if ((i > this.parm1 + this.parm2 + 2) && (this.efiEma_parm1[i] - this.MA_parm2OfEfiEma_parm1[i] >= 0.0F) && (this.efiEma_parm1[(i - 1)] - this.MA_parm2OfEfiEma_parm1[(i - 1)] < 0.0F))
/*     */       {
/* 668 */         this.x1 = this.startPointX;
/* 669 */         this.x2 = (this.startPointX - this.stickWidth - 1.0F * this.xScale);
/* 670 */         this.y1 = this.p1Y;
/* 671 */         this.y2 = this.p2Y;
/* 672 */         this.u1 = this.x1;
/* 673 */         this.u2 = this.x2;
/* 674 */         this.v1 = this.p11Y;
/* 675 */         this.v2 = this.p22Y;
/*     */ 
/* 677 */         this.b1 = ((this.y1 - this.y2) / (this.x1 - this.x2));
/* 678 */         this.a1 = (this.y1 - this.b1 * this.x1);
/*     */ 
/* 680 */         this.b2 = ((this.v1 - this.v2) / (this.u1 - this.u2));
/* 681 */         this.a2 = (this.v1 - this.b2 * this.u1);
/*     */ 
/* 683 */         this.xi = (-1.0D * (this.a1 - this.a2) / (this.b1 - this.b2));
/* 684 */         this.yi = (this.a1 + this.b1 * this.xi);
/*     */ 
/* 686 */         paramGraphics2D.setPaint(Color.green);
/* 687 */         this.uA.setLine(this.xi, this.yi - 5.0D, this.xi, this.yi + 5.0D);
/* 688 */         this.lA.setLine(this.xi, this.yi - 5.0D, this.xi - 3.0D, this.yi);
/* 689 */         this.hA.setLine(this.xi, this.yi - 5.0D, this.xi + 3.0D, this.yi);
/* 690 */         paramGraphics2D.draw(this.uA);
/* 691 */         paramGraphics2D.draw(this.lA);
/* 692 */         paramGraphics2D.draw(this.hA);
/*     */       }
/*     */ 
/* 696 */       if ((i > this.parm1 + this.parm2 + 2) && (this.efiEma_parm1[i] - this.MA_parm2OfEfiEma_parm1[i] < 0.0F) && (this.efiEma_parm1[(i - 1)] - this.MA_parm2OfEfiEma_parm1[(i - 1)] > 0.0F))
/*     */       {
/* 698 */         this.x1 = this.startPointX;
/* 699 */         this.x2 = (this.startPointX - this.stickWidth - 1.0F * this.xScale);
/* 700 */         this.y1 = this.p1Y;
/* 701 */         this.y2 = this.p2Y;
/* 702 */         this.u1 = this.x1;
/* 703 */         this.u2 = this.x2;
/* 704 */         this.v1 = this.p11Y;
/* 705 */         this.v2 = this.p22Y;
/*     */ 
/* 707 */         this.b1 = ((this.y1 - this.y2) / (this.x1 - this.x2));
/* 708 */         this.a1 = (this.y1 - this.b1 * this.x1);
/*     */ 
/* 710 */         this.b2 = ((this.v1 - this.v2) / (this.u1 - this.u2));
/* 711 */         this.a2 = (this.v1 - this.b2 * this.u1);
/*     */ 
/* 713 */         this.xi = (-1.0D * (this.a1 - this.a2) / (this.b1 - this.b2));
/* 714 */         this.yi = (this.a1 + this.b1 * this.xi);
/*     */ 
/* 716 */         paramGraphics2D.setPaint(Color.red);
/* 717 */         this.uA.setLine(this.xi, this.yi - 5.0D, this.xi, this.yi + 5.0D);
/* 718 */         this.lA.setLine(this.xi, this.yi + 5.0D, this.xi - 3.0D, this.yi);
/* 719 */         this.hA.setLine(this.xi, this.yi + 5.0D, this.xi + 3.0D, this.yi);
/* 720 */         paramGraphics2D.draw(this.uA);
/* 721 */         paramGraphics2D.draw(this.lA);
/* 722 */         paramGraphics2D.draw(this.hA);
/*     */       }
/*     */ 
/* 726 */       if (this.dateRef == i)
/*     */       {
/* 728 */         paramGraphics2D.setFont(this.ssp9);
/* 729 */         str = ((String)this.sq.date.get(i)).substring(0, 6);
/* 730 */         if (this.efiEma_parm1[i] >= this.MA_parm2OfEfiEma_parm1[i])
/* 731 */           paramGraphics2D.setPaint(Color.green);
/*     */         else {
/* 733 */           paramGraphics2D.setPaint(Color.red);
/*     */         }
/* 735 */         paramGraphics2D.drawString(str, (int)this.startPointX, (int)(this.yScale * 100.0F + 20.0F));
/* 736 */         if (this.noOfDays == 150)
/* 737 */           this.dateRef -= 10;
/*     */         else
/* 739 */           this.dateRef -= 20;
/* 740 */         paramGraphics2D.setFont(this.ssp10);
/*     */       }
/*     */ 
/* 744 */       this.startPointX = (this.startPointX - this.stickWidth - 1.0F * this.xScale);
/* 745 */       this.daysRef += 1;
/*     */     }
/*     */   }
/*     */ 
/*     */   public static void main(String[] paramArrayOfString)
/*     */   {
/* 812 */     FileDownloader localFileDownloader = new FileDownloader();
/* 813 */     localFileDownloader.downloadFiles();
/* 814 */     SymQuotes localSymQuotes = new SymQuotes("WIPRO", localFileDownloader.datesToRead, 1, 1, "ns");
/*     */ 
/* 816 */     EFIChart localEFIChart = new EFIChart(localSymQuotes, 10, 5);
/*     */ 
/* 818 */     JFrame localJFrame = new JFrame("Test");
/* 819 */     localJFrame.setDefaultCloseOperation(3);
/* 820 */     localJFrame.getContentPane().add(localEFIChart);
/* 821 */     localJFrame.pack();
/* 822 */     localJFrame.setSize(850, 175);
/* 823 */     localJFrame.setVisible(true);
/*     */   }
/*     */ 
/*     */   public class EastPanel extends JPanel
/*     */   {
/*     */     private JLabel title;
/*     */     private JLabel efiEmaL;
/*     */     private JLabel MaOfefiEmaL;
/*     */     private JLabel MaOfefiEmaL1;
/*     */     private JLabel trendL;
/*     */     private ChartHelpButton chb;
/* 757 */     private Font valuesF = new Font("Sanserif", 0, 11);
/* 758 */     public Box buttonsPanel = Box.createHorizontalBox();
/*     */ 
/*     */     public EastPanel()
/*     */     {
/* 762 */       this.title = new JLabel("EFI");
/* 763 */       this.efiEmaL = new JLabel("EFI EMA[" + EFIChart.this.parm1 + "]: " + EFIChart.this.df.format(EFIChart.this.efiEma_parm1[(EFIChart.this.sq.count - 1)]));
/* 764 */       this.MaOfefiEmaL = new JLabel("MA" + EFIChart.this.parm2 + "(EFI EMA[" + EFIChart.this.parm1 + "]):");
/* 765 */       this.MaOfefiEmaL1 = new JLabel(EFIChart.this.df.format(EFIChart.this.MA_parm2OfEfiEma_parm1[(EFIChart.this.sq.count - 1)]));
/*     */ 
/* 767 */       this.trendL = new JLabel("Trend: " + EFIChart.this.trend);
/* 768 */       this.chb = new ChartHelpButton("http://www.profitindicators.com/home/indicators/efi.htm", "Help on EFI");
/*     */ 
/* 770 */       this.chb.setFont(this.valuesF);
/*     */ 
/* 772 */       this.efiEmaL.setFont(this.valuesF);
/* 773 */       this.MaOfefiEmaL.setFont(this.valuesF);
/* 774 */       this.MaOfefiEmaL1.setFont(this.valuesF);
/* 775 */       this.trendL.setFont(this.valuesF);
/*     */ 
/* 777 */       this.buttonsPanel.add(this.chb);
/* 778 */       this.buttonsPanel.add(Box.createHorizontalStrut(2));
/* 779 */       this.buttonsPanel.setAlignmentX(0.0F);
/*     */ 
/* 781 */       setLayout(new BoxLayout(this, 3));
/*     */ 
/* 783 */       add(this.title);
/* 784 */       add(this.efiEmaL);
/* 785 */       add(this.MaOfefiEmaL);
/* 786 */       add(this.MaOfefiEmaL1);
/* 787 */       add(new JLabel(" "));
/* 788 */       add(this.trendL);
/* 789 */       add(this.buttonsPanel);
/* 790 */       add(Box.createVerticalGlue());
/*     */ 
/* 792 */       setBackground(new Color(243, 245, 252));
/*     */     }
/*     */ 
/*     */     public void updateValues()
/*     */     {
/* 799 */       this.efiEmaL.setText("EFI EMA[" + EFIChart.this.parm1 + "]: " + EFIChart.this.df.format(EFIChart.this.efiEma_parm1[(EFIChart.this.sq.count - 1)]));
/* 800 */       this.MaOfefiEmaL.setText("MA" + EFIChart.this.parm2 + "(EFI EMA[" + EFIChart.this.parm1 + "]):");
/* 801 */       this.MaOfefiEmaL1.setText(EFIChart.this.df.format(EFIChart.this.MA_parm2OfEfiEma_parm1[(EFIChart.this.sq.count - 1)]));
/* 802 */       this.trendL.setText("Trend: " + EFIChart.this.trend);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Deebak\Downloads\profitindicatorsv2-05.jar
 * Qualified Name:     EFIChart
 * JD-Core Version:    0.6.0
 */